<?php
	if ($_POST['email'] && $_POST['pword']) {
		include("includes/checkCredentials.php");
		$result = signUp($_POST['email'],$_POST['pword']);
		if ($result == 0) {
			session_start();
			$_SESSION['email'] = $_POST['email']; 
			$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
			header( 'Location: index.php' );
		} else {
			$email = $_POST['email'];
		}
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>Species Migration Model - Sign Up</title>
	<link rel="stylesheet" href="style.css" type="text/css" />
  </head>
  <body>
	<div id="content">
		<div id="top">
			<h3>Please Sign Up</h3>
		</div>
		<div id="bottom">
			<div class="inside">
				<form id="addRemoveEnvEvent" name="addRemoveEnvEvent" action="<?php $_SERVER['self'] ?>" method="post">
					<h5>Email </h5>
					<input id="email" type="text" name="email" value="<?php print $email ?>" size="15" />
					<h5>Password </h5>
					<input id="pword" type="password" name="pword" size="15" />
					<br />
					<input type="submit" value="Sign Up" />
				</form>
			</div>
		</div
	</div>
  </body>
</html>